package android.google.volley.toolbox;

import java.io.UnsupportedEncodingException;

import org.json.JSONException;
import org.json.JSONObject;

import android.google.volley.NetworkResponse;
import android.google.volley.ParseError;
import android.google.volley.Response;
import android.google.volley.Request.Method;
import android.google.volley.Response.ErrorListener;
import android.google.volley.Response.Listener;

public class StringUTF8Request extends StringRequest
{

	public StringUTF8Request(int method, String url, Listener<String> listener,
			ErrorListener errorListener)
	{
		super(method, url, listener, errorListener);
	}

	@Override
	protected Response<String> parseNetworkResponse(NetworkResponse response)
	{
		String parsed;
		try
		{
			parsed = new String(response.data,"UTF-8");
		} catch (UnsupportedEncodingException e)
		{
			parsed = new String(response.data);
		}
		return Response.success(parsed,
				HttpHeaderParser.parseCacheHeaders(response));
	}

}
